<template>
    <div>
        <el-radio-group v-model="radio1" size="medium ">
            <el-radio-button label="派发管理中心"></el-radio-button>
            <el-radio-button label="处理"></el-radio-button>
            <el-radio-button label="其他"></el-radio-button>
            <!-- 0中心处理1路网审核2处理完成3处理失败4处理不了提交路网 -->
        </el-radio-group>
        <div style="margin-top:40px" v-if="radio1 == '派发管理中心'">
            <el-row :gutter="10">
                <el-col :span="12">
                    <el-select v-model="value" placeholder="请选择">
                        <el-option v-for="item in managementCenter" :key="item.id" :label="item.nickname" :value="item.id">
                        </el-option>
                    </el-select>
                </el-col>
            </el-row>
            <el-row type="flex" justify="center" style="margin-top:40px">
                <el-button type="primary" icon="el-icon-check" @click="wancheng">完成</el-button>
            </el-row>
        </div>
        <div style="margin-top:40px" v-if="radio1 == '处理'">
            <el-row :gutter="10">

            </el-row>
            <el-row :gutter="10">
                <el-col :span="13">
                    <div>上传图片：</div>
                </el-col>
                <el-col :span="12">
                    <el-upload-image v-model="replyImg"></el-upload-image>
                </el-col>
            </el-row>
            <el-row :gutter="10">
                <el-col :span="13">
                    <div>备注：</div>
                </el-col>
                <el-col :span="12">
                    <el-input type="textarea" rows="5" v-model="reply"></el-input>
                </el-col>
            </el-row>
            <el-row type="flex" justify="center" style="margin-top:40px">
                <el-button type="primary" icon="el-icon-check" @click="aduit">完成</el-button>
            </el-row>
        </div>
        <div style="margin-top:40px" v-if="radio1 == '其他'">
            <el-row :gutter="10">
                <el-col :span="13">
                    <div> 备注：</div>
                </el-col>
                <el-col :span="12" style="margin-top:20px">
                    <el-input type="textarea" rows="5" v-model="failure"></el-input>
                </el-col>
            </el-row>
            <el-row type="flex" justify="center" style="margin-top:40px">
                <el-button type="primary" icon="el-icon-check" @click="other">是</el-button>
            </el-row>
        </div>
    </div>
</template>

<script>
import { post } from '@/assets/js/http';

export default {
    components: {
        "el-upload-image": () => import("@/components/el-upload-image.vue")
    },
    props: {
        managementCenter: {
            type: Array,
            default: () => []
        },
        rowData: {
            type: Object,
            default: () => { }
        }
    },
    data() {
        return {
            radio1: "派发管理中心",
            value: "",
            reply: "",
            failure: "",
            replyImg: [],
        }
    },

    methods: {
        //派发管理中心
        wancheng() {
            post({
                url: "/admin/answer.Subject/road_work",
                data: {
                    id: this.rowData.id,
                    cl_status: 0,//0中心处理1路网审核2处理完成3处理失败4处理不了提交路网
                    g_admin_id: this.value,

                },
                successTip: true,
                loading: true
            }).finally(() => {
                this.$emit("closePopover", false)
            })
        },
        //处理
        aduit() {
            post({
                url: "/admin/answer.Subject/road_work",
                data: {
                    id: this.rowData.id,
                    cl_status: 2,//0中心处理1路网审核2处理完成3处理失败4处理不了提交路网
                    reply: this.reply,
                    reply_img: this.replyImg[0].url
                },
                loading: true,
                successTip: true

            }).finally(() => {
                this.$emit("closePopover", false)

            })
        },
        //其他
        other() {
            post({
                url: "/admin/answer.Subject/road_work",
                data: {
                    id: this.rowData.id,
                    cl_status: 3,//0中心处理1路网审核2处理完成3处理失败4处理不了提交路网
                    reply: this.failure
                },
                loading: true,
                successTip: true

            }).finally(() => {
                this.$emit("closePopover", false)
            })
        }
    }
}
</script>

<style></style>